package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016110200786382";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCuZokfVCf/7+rZqcTg8udg2+TspYOm01VILG+P06+IEroGzUyyxzfFo0ed2DnbgZEQf29avTugXJf5LpNGWDuP0L6v0XULB4zzv8rDTiKd0ySWHF17ZhVysdniUnaxYXT2spN593TbWxm/qo34ZOM2LSjknINi5sv5k8ujYETB1BbYXQ9JNsnRL4gimLV6kX6SOrN3acsqDQoOrEdGEIKarKHJjpzE9/aRGYk0KDWaPK+xWOgiAxuv2Fgs3xA/v6QtY7C9him+k/jRywf6IfMZ7DDhJBa5TtGqRAl5sdP3MII393a+lSAzzQakWYwPoxvt5oFN4lqsDiA0iPNOVUGlAgMBAAECggEBAIwdavtVlJFmgst/PuLvpH9IC6Mo0x272l+S+8qU6wiq6vQ+CunzblaF+SrSpqE5dn/HsoI3WGldGugiyEYS6z9/GUSORremyFKo+1FwPBWKpnFHtr9GY+LzCrdvQ1b9kogFLsEl06fMiGJZt5giDf3fyGPrbw+Nl8EbQdcvp+4Ejw4WqTsiF/25ZSEavmL0m4POeSdyzoMHhch5bB2EurlFXdY3K/j0smAnRnYzuJt+KYZTQQD/kjUty6N/L2Nu8+L38qOcpxGLtYVnRp7IdqL5nXTYR293zLDbyJ7gPn8kH6CqAikNXIPrTJEk8qQQzebiNIJaBhWQ/0U4JitF/D0CgYEA66yNgZuuIz6st1KOCi4tkVftd69tIKdxnF+1IiRcgst+Kyb8v+/GR3v+XjzhVo45v5t3qRYCptufjHNjXhWhCc5qxyGffg2rZJBexAX/ewPRvH2iiLco1+ANfIqHAULWP34lcryF7CwYgZfHeM4PIFiL1VgWrrh/vf6D8wLM7bMCgYEAvXEgBy5HTfQAm0oCzgs6xHKtSG68K+nmjqwbBN9Xlys71B6AreinS2qmdPasTb6Pg2v6RP3tpOpkhVXsp+XV7ceC7YKuKnKlhFY1g5yfaodlnVHfcGFmKJQrXtMSACmbX7vUhTxD1PTvDR2PlQEF2Lln0lLaIlL7kOPl4KGq10cCgYAoNu6Ckj0ZuIUiVwzzwcN2zKkxxhZ5/viM9WvkIo5Cp1SlKmbwnYqZAhh6nirZaTWDc5TsnlvfexRzk/D9yfULxlREHIGpsc1wQI5bJqbcp98vKcUFTTPD+nBysvSsi2ohtXXQaUj07uVTn8Gi5I6CN3nM8tYUBFmP4xFC81RirwKBgE/gUAHXGIec11iixzX7dCb6t2ewETVu5SDJHodaaIM73nkc92LckxVwfYkZrSMGs1pVf+vxKW98yS+TQDq25RHiKqlcjXUma/W1p9C7jFgNiOHhcJXg64M2nmbYFmHtKS8fcodPFsbHE7hy+2R3TvDHlCgReRo55Qp9nSKu5+rnAoGAY47cBwfa7Yl4FC85W9L1yM5GA/BIxw3HbreGlO988LHO4VoDAVZQw7V12xE1uiDRvGmi8c0sefWaXx8L2CX7DfPCYaDcJR0m7mMzEUwTiYgO8g1/dRWiZUDFKcBmWh1jYxcwjU4Z9GqZj3zM57JhXMMGqu1NyGK4ir8M9C/RLe4=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr1mPk6rIzSaYkaOthD0zsivN4pln2o66yP1DdIuauV6ggAC6jkO7kfZHJmBYXY/oGXPSbWqdn2g8s6FHJzLAjT9XMOqhFtQh5mMCTr5/gdgN6oc9O/zYCD1xEV9pAXZ1rBufzXixjmlnA8lCNiLsRUcYjoAcUyDBPUP3iLTvFJm1XhmA3ogR5U2CR56wynIa+toaCLxEav9S6gkjALmLwFSkimySEUZB361f+kXCcO+riZwsO65uquXEH8p7z44hezkqT09kaEIQDAHXH6f/RhOzmAuNQHSD93DbzvjrWPyW2vYA/eQnPLNc+ctka/Nf6CH5X4XMfmp9q+4p19URcQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

